import { http } from "@/utils/http";

/**
 * 树形菜单
 * @returns {Promise<unknown>}
 */
export const tree = () => {
  return http.get("/sys/menu/tree");
};

/**
 * 菜单子级
 * @param id
 * @returns {Promise<unknown>}
 */
export const children = id => {
  return http.get("/sys/menu/children", { id });
};

/**
 * 菜单详情
 * @param id
 */
export const detail = id => {
  return http.get( `/sys/menu/detail/${id}`);
}

/**
 * 新增菜单
 * @param data
 * @returns {Promise<unknown>}
 */
export const add = (data) => {
  return http.post( `/sys/menu`, null, data);
}

/**
 * 修改菜单
 * @param data
 * @returns {Promise<unknown>}
 */
export const modify = (data) => {
  return http.put( `/sys/menu`, null, data);
}

